#ifndef REPEATER_WIN
#define REPEATER_WIN

#include <atlbase.h>
#include <atlapp.h>
#include <atlgdi.h>
#include <atlmisc.h>
#include <atlwin.h>
#include <atlcrack.h>
#include <atlctrls.h>
#include <vfw.h>
#include "bar.h"
typedef CWinTraits<WS_POPUP | WS_SYSMENU /*| WS_CAPTION*/   | WS_BORDER|WS_VISIBLE, WS_EX_TOPMOST> RepeaterWinTraits;
class RepeaterWindow: public CWindowImpl< RepeaterWindow, CWindow, RepeaterWinTraits>
{
public:
    DECLARE_WND_CLASS(_T("REPEATER_WIN"))

    BEGIN_MSG_MAP_EX(RepeaterWindow)
        MSG_WM_CREATE(OnCreate)
        MSG_WM_CLOSE(OnClose)
        MSG_WM_DESTROY(OnDestroy)
        MSG_WM_NCHITTEST(OnNcHitTest)
        MSG_WM_PAINT(OnPaint)
        MSG_WM_DROPFILES(OnDropFiles)
        //MESSAGE_HANDLER(MCIWNDM_NOTIFYPOS, OnStep)
        MESSAGE_HANDLER(MCIWNDM_NOTIFYMODE, OnNotifyMode)
        MSG_WM_HOTKEY(OnHotKey)
        MSG_WM_TIMER(OnTimer)
        MSG_WM_DRAWITEM(OnDrawItem)
    END_MSG_MAP()

    void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
    void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey);    
    LRESULT CALLBACK OnNotifyMode(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& handled);
    void OnTimer(UINT_PTR nIDEvent);
    LRESULT CALLBACK OnStep(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& handled);
    RepeaterWindow();
    void OnDropFiles(HDROP hDropInfo);
    void OnPaint(CDCHandle dc);
    UINT OnNcHitTest(CPoint point);
    LRESULT OnClose();
    LRESULT OnCreate(LPCREATESTRUCT lpcs);
    LRESULT OnDestroy();
private:
    CRect rect_, barRect_, titleBarRect_, CloseRect_;
    ATOM hotkey_;
    ProgressBar bar_;
    Player player_;
    static const int timerId_ = 199;
    //CButton closeButton_;
};

#endif